package com.itboye.jinpuyiyuan.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.itboye.jinpuyiyuan.R;
import com.itboye.jinpuyiyuan.bean.DailyInfoBean;

import java.util.List;

public class DailyOrderAdapter extends BaseAdapter {

    Context context;
    List<DailyInfoBean.Fee.FeeDetail.ItemDetail> list;
    public DailyOrderAdapter(Context context, List<DailyInfoBean.Fee.FeeDetail.ItemDetail> list){

        this.list=list;
        this.context=context;

    }
    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        MyViewHolder holder;
        if (convertView==null){
            convertView= LayoutInflater.from(context).inflate(R.layout.item_dailylist_adapter, null, false);
            holder=new MyViewHolder(convertView);
            convertView.setTag(holder);
        }else {
            holder= (MyViewHolder) convertView.getTag();
        }

        holder.item01.setText(list.get(position).getItem_name());
        holder.item02.setText(list.get(position).getItem_price());
        holder.item03.setText(list.get(position).getItem_no());
        holder.item04.setText(list.get(position).getItem_money());

        return convertView;
    }

    public class MyViewHolder{
        TextView  item01,item02,item03,item04;


        public MyViewHolder(View itemView){

            item01=itemView.findViewById(R.id.item_01);
            item02=itemView.findViewById(R.id.item_02);
            item03=itemView.findViewById(R.id.item_03);
            item04=itemView.findViewById(R.id.item_04);

        }
    }
}
